#!/usr/bin/env python
# -*- coding: utf-8 -*-

def counter(start=0):
    def incr():
        nonlocal start
        start += 1
        return start
    return incr

incr = counter(100)
print(incr())       #101
print(incr())       #102

incr2 = counter(200)
print(incr2())      #201
print(incr2())      #202
print(incr())       #103

def test():
    a = 1
    def test2():
        a = 2
        print(locals())
    return test2
test()()